{% extends "xhs/layout.html" %}

{% block title %}小红书数据管理系统 - {{ location.location_name }} 详情{% endblock %}

{% block page_title %}地理位置: {{ location.location_name }}{% endblock %}

{% block page_actions %}
<a href="/locations" class="btn btn-sm btn-outline-secondary">
    <i class="fas fa-arrow-left"></i> 返回位置列表
</a>
{% endblock %}

{% block content %}
<div class="row">
    <div class="col-lg-4">
        <div class="card mb-4">
            <div class="card-header">
                <i class="fas fa-map-marker-alt text-danger"></i> 位置信息
            </div>
            <div class="card-body">
                <div class="text-center mb-4">
                    <i class="fas fa-map-marked-alt fa-4x text-danger mb-3"></i>
                    <h4>{{ location.location_name }}</h4>
                </div>
                
                <div class="row text-center mb-4">
                    <div class="col-12">
                        <div class="h3">{{ location.count }}</div>
                        <div class="text-muted">笔记数量</div>
                    </div>
                </div>
                
                <div class="border-top pt-3">
                    <p class="text-muted">{{ location.description }}</p>
                    <p class="text-muted small">该位置信息是从笔记的edit_time字段中提取的</p>
                </div>
            </div>
        </div>
    </div>
    
    <div class="col-lg-8">
        <div class="card mb-4">
            <div class="card-header">
                <i class="fas fa-book-open text-danger"></i> 来自该地区的笔记
            </div>
            <div class="card-body">
                {% if notes %}
                <div class="table-responsive">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th>标题</th>
                                <th>作者</th>
                                <th>发布时间</th>
                                <th>点赞</th>
                                <th>收藏</th>
                                <th>评论</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for note in notes %}
                            <tr>
                                <td>
                                    <a href="/notes/{{ note.id }}">{{ note.title|truncate(20) }}</a>
                                </td>
                                <td>{{ note.author|default('未知') }}</td>
                                <td>{{ note.edit_time }}</td>
                                <td>{{ note.likes|default(0) }}</td>
                                <td>{{ note.collects|default(0) }}</td>
                                <td>{{ note.comments|default(0) }}</td>
                                <td>
                                    <a href="/notes/{{ note.id }}" class="btn btn-sm btn-outline-info">
                                        <i class="fas fa-eye"></i>
                                    </a>
                                </td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
                
                {% else %}
                <div class="text-muted text-center py-4">
                    <i class="fas fa-book-open fa-3x mb-3"></i>
                    <p>暂无该地区的笔记数据</p>
                </div>
                {% endif %}
            </div>
        </div>
    </div>
</div>
{% endblock %} 